import numpy as np 
 
x=np.arange(32).reshape((8,4))
print(x)
'''
[[ 0  1  2  3]
 [ 4  5  6  7]
 [ 8  9 10 11]
 [12 13 14 15]
 [16 17 18 19]
 [20 21 22 23]
 [24 25 26 27]
 [28 29 30 31]]
'''

# 1.获取行方法
'''
x[[行row]]
x[[行a, 行b, ...]]
'''

# 2.获取第 4,2,1,7行
print(x[[4,2,1,7]])    
'''
[[16 17 18 19]
 [ 8  9 10 11]
 [ 4  5  6  7]
 [28 29 30 31]]
'''

# 3.倒序获取行, 获取-1, -4行
print(x[[-1,-4]])
'''
[[28 29 30 31]
 [16 17 18 19]]
'''